package com.example.shengyin.service;


import com.example.shengyin.dao.ProfessorMapper;
import com.example.shengyin.entity.Appoint;
import com.example.shengyin.entity.Page;
import com.example.shengyin.entity.Professor;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProfessorService {

    @Autowired
    private ProfessorMapper dao;

    public int add(Professor professor)
    {
        return dao.add(professor);
    }
    public int update(Professor professor)
    {
        return dao.update(professor);
    }
    public int delByIds(String ids)
    {
        return dao.delByIds(ids);
    }
    public int delById(int id)
    {
        return dao.delById(id);
    }
    public Professor selectById(Long id) {return dao.selectById(id);}

    public Page selectList( String pname, String ptype, String pos, int pageNo, int pageSize) {
        List<Professor> list = dao.selectList(pname,ptype,pos,pageNo,pageSize);
        int total=dao.fand(pname,ptype,pos);
        return new Page(list,pageNo,total,pageSize);
    }

    public int updateIsvalid(@Param("isvalid")boolean isvalid,@Param("id")Long id){
        return dao.updateIsvalid(isvalid,id);
    }

    public int fand(String pname,String ptype, String pos) {
        return dao.fand(pname,ptype,pos);
    }

}
